<template>
  <el-container class="bg-white rounded" :style="{ height: h + 'px' }">
    <el-header class="image-header">
      <el-button type="primary" size="default" @click="handleAdd"
        >新增图库分类</el-button
      >
      <el-button type="warning" size="default" @click="handleUpload"
        >上传图片</el-button
      >
    </el-header>
    <el-container>
      <ImageAside ref="ImageAsideRef" @change="handleClick" />
      <ImageMain ref="ImageMainRef" />
    </el-container>
  </el-container>
</template>
<script setup>
import { ref } from 'vue'
import ImageAside from '@/components/ImageCom/ImageAside.vue'
import ImageMain from '@/components/ImageCom/ImageMain.vue'
import { toast } from '../../composables/util'
const windowHeight = window.innerHeight || document.body.clientHeight
const h = windowHeight - 64 - 44 - 40

// 打开'新增图库分类'抽屉
const ImageAsideRef = ref(null)
const handleAdd = () => {
  ImageAsideRef.value.openDrawer()
}
const ImageMainRef = ref(null)
const handleClick = ImageClassId => {
  ImageMainRef.value.loadData(ImageClassId)
}
const handleUpload = () => {
  toast('功能开发中', '敬请期待', 'warning')
}
</script>
<style>
.image-header {
  border-bottom: 1px solid #eeeeee;
  @apply flex items-center;
}
</style>
